<?php
include "../config/koneksi.php";
include "../class/order.php";
include "../class/konsumen.php";
include "../class/keranjang.php";
include "../class/produk.php";
include "../class/toko.php";

if (ISSET($_GET["id_konsumen"])){
$id_konsumen=$_GET["id_konsumen"];
}
if (ISSET($_GET["orderid"])){
$orderid=$_GET["orderid"];
}

$Order_Dao = new Order_Dao();
$order=$Order_Dao->get($orderid);
$Keranjang_Dao = new Keranjang_Dao();
$keranjang=$Keranjang_Dao->get_order ($order->orderid);
$Konsumen_Dao = new Konsumen_Dao();
$konsumen=$Konsumen_Dao->get($order->id_konsumen);
if($order->status==2){
	$status='Siap Kirim';
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<table width="100%" height="30" border="0" cellpadding="0" cellspacing="0">
  <tr >
    <td height="30"> 
      <div align="left"><font size="3" face="tahoma">Data Pesanan Siap Kirim</font><hr color=#CCCCFF></div></td>
    </tr>
  </table>
<table width="90%" align="center" border=1 cellPadding=3 cellSpacing=0 bgcolor="#FFFFFF" id=table9>

  <tr bgColor=#d4d4d4> 
    <td colspan="3" bgColor=#666666> 
      <div align="center"><font color="#FFFFFF" size="2" face="tahoma">Detil Data Pesanan In Progress</font></div></td>
  </tr>
  <tr valign="top"> 
    <td width="31%"> <font size="2" face="tahoma">Order ID </font></td>
    <td width="1%"><font face="tahoma">:</font></td>
     <td width="68%"><font face="tahoma" size="2"><?echo"$order->orderid";?></font></td>
  </tr>
 <tr valign="top"> 
    <td width="31%"> <font size="2" face="tahoma">Nama </font></td>
    <td width="1%"><font face="tahoma">:</font></td>
     <td width="68%"><font face="tahoma" size="2"><?echo"$konsumen->nama_pembeli";?></font></td>
  </tr>
  <tr valign="top"> 
    <td><font size="2" face="tahoma">Alamat</font></td>
    <td><font face="tahoma">:&nbsp;</font></td>
    <td><font face="tahoma" size="2"><?echo"$konsumen->alamat_pembeli";?></font></td>
  </tr>
  <tr valign="top"> 
    <td><font size="2" face="tahoma">Kode Pos </font></td>
    <td><font face="tahoma">:&nbsp;</font></td>
    <td><font face="tahoma" size="2"><?echo"$konsumen->kodepos";?></font></td>
  </tr>
  <tr valign="top"> 
    <td><font size="2" face="tahoma">Telepon / HP</font></td>
    <td><font face="tahoma">:&nbsp;</font></td>
    <td><font face="tahoma" size="2"><?echo"$konsumen->telepon";?></font></td>
  </tr>
  <tr valign="top"> 
    <td><font size="2" face="tahoma">Email</font></td>
    <td><font face="tahoma">:&nbsp;</font></td>
    <td><font face="tahoma" size="2"><?echo"$konsumen->email_pembeli";?></font></td>
  </tr>
  <tr valign="top"> 
    <td><font size="2" face="tahoma">Rekening Bank</font></td>
    <td><font face="tahoma">:&nbsp;</font></td>
    <td><font face="tahoma" size="2"><?echo"$konsumen->nama_bank_pembeli";?></font></td>
  </tr>
  <tr valign="top"> 
    <td><font size="2" face="tahoma">Cabang</font></td>
    <td><font face="tahoma">:&nbsp;</font></td>
    <td><font face="tahoma" size="2"><?echo"$konsumen->cabang_bank_pembeli";?></font></td>
  </tr>
  <tr valign="top"> 
    <td><font size="2" face="tahoma">Atas Nama</font></td>
    <td><font face="tahoma">:&nbsp;</font></td>
    <td><font face="tahoma" size="2"><?echo"$konsumen->atas_nama";?></font></td>
  </tr>
  <tr valign="top"> 
    <td><font size="2" face="tahoma">Nomor Rekening</font></td>
    <td><font face="tahoma">:&nbsp;</font></td>
    <td><font face="tahoma" size="2"><?echo"$konsumen->nomor_rekening";?></font></td>
  </tr>
   <tr valign="top"> 
    <td><font size="2" face="tahoma">Total</font></td>
    <td><font face="tahoma">:&nbsp;</font></td>
    <td><font face="tahoma" size="2">Rp.<?echo"$order->total";?></font></td>
  </tr>
  <tr valign="top"> 
    <td><font size="2" face="tahoma">Status</font></td>
    <td><font face="tahoma">:&nbsp;</font></td>
    <td><font face="tahoma" size="2"><?echo"$status";?></font></td>
  </tr>
</table>
<?
echo"<center><u><font face=tahoma size=2><br>Detil Pemesanan</font><br><br></u>";
?>
<br>
<table width="90%" align="center" border=1 cellPadding=3 cellSpacing=0 bgcolor="#FFFFFF" id=table9>
  <tbody>
    <tr> 
      <td width=51 align=center bgColor=#d4d4d4><font face=tahoma color=#3b3b3b size=1>No</font></td>
	  <td width=185 bgColor=#d4d4d4 align=center><font face=tahoma color=#3b3b3b size=1>Nama Produk</font></td>
	  <td width=185 bgColor=#d4d4d4 align=center><font face=tahoma color=#3b3b3b size=1>Toko</font></td>
	  <td align=center width=144 bgColor=#d4d4d4 colSpan=2><FONT face=tahoma color=#3b3b3b size=1>Harga Satuan</font></td>
      <td align=center width=56 bgColor=#d4d4d4><FONT face=tahoma color=#3b3b3b size=1>Jumlah</font></td>
      <td colspan="3" align=center bgColor=#d4d4d4><FONT face=tahoma color=#3b3b3b size=1>TOTAL</font></td>
  
    </tr>
<?php
if (ISSET($_GET["orderid"])){
$orderid=$_GET["orderid"];
}
$Keranjang_Dao = new Keranjang_Dao();
$keranjang=$Keranjang_Dao->get_order($orderid);
$k=1;
foreach($keranjang as $keranjang1){
$orderid=$keranjang1->orderid;
$Produk_Dao=new Produk_Dao();
$produk=$Produk_Dao->get($keranjang1->id_oleh2);
$Toko_Dao=new Toko_Dao();
$toko=$Toko_Dao->get($produk->id_toko);
$total=$produk->harga*$keranjang1->jumlah;
echo"
  <tr> 
      <td width=51 valign=top><div align=center><FONT color=#000000 size=1 face=tahoma>$k</font></div></td>
      <td valign=top align=center width=165><FONT face=tahoma color=#3b3b3b size=1>$produk->nama_oleh2</font></td>
	  <td valign=top align=center width=165><FONT face=tahoma color=#3b3b3b size=1>$toko->nama_toko</font></td>
	  <td valign=top align=left width=25><FONT face=tahoma size=1>Rp.</font></td>
      <td valign=top align=left width=79><FONT face=tahoma size=1>$produk->harga</font></td>
      <td valign=top align=left><FONT face=tahoma size=1>$keranjang1->jumlah</font></td>
      <td valign=top align=right width=25><FONT face=tahoma size=1>Rp.</font></td>
      <td valign=top align=right width=75><FONT face=tahoma size=1>$total</font></td>
    </tr>";
	$k++;}
echo"</table>";
echo"<br><a href=simpanarsip.php?orderid=$orderid><input type=submit value='Barang Terkirim / Simpan Arsip'></a>";
echo"<br><br>";
?>

<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr valign="top"> 
    <td colspan="2"><font size="2" face="tahoma"><strong>Keterangan :</strong>&nbsp;</font></td>
  </tr>
  <tr valign="top"> 
    <td width="2%"><font size="2" face="tahoma">&nbsp;</font></td>
    <td width="98%" align="justify"><font size="2" face="tahoma">
      Transaksi Siap Kirim adalah transaksi yang sudah melakukan konfirmasi pembayaran dan siap kirim </font></td>
  </tr>
</table>
<p>&nbsp;</p>
</body>
</html>